package com.fangbaba.crm;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.baidu.android.pushservice.PushMessageReceiver;
import com.lezhu.plugin.LZNotifyListener;

import java.util.Date;
import java.util.List;

/**
 * Created by zhaoshengbo on 16/2/17.
 */
public class PushReceiver extends PushMessageReceiver {

    public static String CHANNEL_ID = null;

    public PushReceiver() {
        this.getClass();
    }

    @Override
    public void onBind(Context context, int i, String s, String s1, String s2, String s3) {
        /**
         * 参数说明
         *  String appid, String userId, String channelId, String requestId)
         */
        CHANNEL_ID = s2;
    }

    @Override
    public void onUnbind(Context context, int i, String s) {
        context.getClass();
    }

    @Override
    public void onSetTags(Context context, int i, List<String> list, List<String> list1, String s) {
    }

    @Override
    public void onDelTags(Context context, int i, List<String> list, List<String> list1, String s) {
    }

    @Override
    public void onListTags(Context context, int i, List<String> list, String s) {
    }

    @Override
    public void onMessage(Context context, String s, String s1) {
        LZNotifyListener.sendNotityMessage("ok");
    }

    @Override
    public void onNotificationClicked(Context context, String s, String s1, String s2) {
        Intent intent = new Intent();
        intent.setClass(context.getApplicationContext(), MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.getApplicationContext().startActivity(intent);
    }

    @Override
    public void onNotificationArrived(Context context, String s, String s1, String s2) {
        LZNotifyListener.sendNotityMessage("ok");
    }
}
